package com.myidis.controller;

import com.myidis.entity.AnalysisIndex;
import com.myidis.entity.AnalysisTheme;
import com.myidis.servlet.CIDIIndexManagementServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/CIDIIndexManagement")
public class CIDIIndexManagementController {
    @Autowired
    private CIDIIndexManagementServlet CIDIIndexManagementServlet;

    @ResponseBody
    @RequestMapping("/subjectList")
    public ArrayList<AnalysisTheme> subjectList(){
        return CIDIIndexManagementServlet.list();
    }

    @ResponseBody
    @RequestMapping("/list")
    public ArrayList<AnalysisIndex> list(){
        return CIDIIndexManagementServlet.all();
    }

    @ResponseBody
    @RequestMapping("/add")
    public int add(@RequestBody AnalysisIndex add){
        return CIDIIndexManagementServlet.add(add);
    }

    @ResponseBody
    @RequestMapping("/cha")
    public int upd(@RequestBody AnalysisIndex upd){
        return CIDIIndexManagementServlet.update(upd);
    }

    @ResponseBody
    @RequestMapping("/del")
    public int del(@RequestBody AnalysisIndex del){
        return CIDIIndexManagementServlet.delete(del);
    }
}
